-
Notifications
You must be signed in to change notification settings - Fork 152
add support for composable queries #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: ff0e9f8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@tanstack/db-example-react-todo commit: |
|
Size Change: -12 B (-0.04%) Total Size: 30.3 kB
ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 972 B ℹ️ View Unchanged
|
|
@samwillis LGTM. One question i have though is why we need to wrap the query in an object with a const { data } = useLiveQuery({
query: myQuery,
})Couldn't we just pass the query as an argument directly without wrapping? |
The wrapping object is currently the liveQueryCollectionOptions, so there is more we can pass in there. I left it as either the callback or this options object to simplify the overloads and not add another. We can always add it later if there is desire to. |
replaces #216, stacked on #185
This allows you to predefine a query with this syntax:
then use it with:
It also enables creating reusable callback functions for use in
where,groupBy,selectetc. with aRef<MyType>to correctly cast to the type for the expression builder functions.Or in a select: